﻿using EditoneLib.Streams;
using System;
using System.IO;

namespace EditoneLib
{
    public class StereoAudioClip : BaseAudioClip
    {
        public StereoAudioClip() : base() { }

        public StereoAudioClip(Stream stream)
            : base(stream)
        {
        }

        public override int NumChannels
        {
            get { return 2; }
        }

        public override Tuple<BaseAudioClip, BaseAudioClip> Split(TimeSpan offset)
        {
            long position = offset.Ticks*Settings.SampleRate/10000000;

            return new Tuple<BaseAudioClip, BaseAudioClip>(
                new StereoAudioClip(new OffsetStream(Stream, 0, position*BlockAlign)),
                new StereoAudioClip(new OffsetStream(Stream, position*BlockAlign))
                );
        }
    }
}